home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / smaltalk / stv.lha / STV / ISA / artifact / oddsends.st < prev    next >
Text File  |  1993-07-23  |  1KB  |  50 lines

  1.  
  2. "
  3.   Smalltalk Tricks (From "Pieces of Cake")
  4.   by Tom Wrensch & Gene Korienek
  5.   See odsends.doc for more information on these methods."!
  6.  
  7. !Object methods !
  8.  
  9. ifNil: aBlock
  10.     "Answer myself since I'm not nil."
  11. ^self! !
  12. !UndefinedObject methods !
  13.  
  14. ifNil: aBlock
  15.     "Answer the value of aBlock."
  16. ^aBlock value! !
  17. !Context methods !
  18.  
  19. untilFalse: aBlock
  20.         "Repeat myself until aBlock evaluates as
  21.          false."
  22.     self value.
  23.     ^aBlock whileTrue: self! !
  24. !Context methods !
  25.  
  26. untilTrue: aBlock
  27.         "Repeat myself until aBlock evaluates as
  28.          true."
  29.     self value.
  30.     ^aBlock whileFalse: self! !
  31.  
  32. !Symbol methods !
  33.  
  34. value: anObject
  35.     "Answer anObject sent the message represented
  36.      by myself. This makes it possible to use a
  37.      symbol in place of a one argument block."
  38. ^anObject perform: self! !
  39.  
  40. !Symbol methods !
  41.  
  42. value: anObject1 value: anObject2
  43.     "Answer anObject1 sent the message represented
  44.      by myself with anObject2 as an argument. This
  45.      makes it possible to use a symbol in place of
  46.      a two argument block."
  47. ^anObject1 perform: self with: anObject2! !
  48.  
  49.  
  50.